import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 定位符
 * 日期 2022/5/5 10:08
 * 创建者：john driver
 */
public class Location {
    public static void main(String[] args) {
        Pattern pattern = Pattern.compile("\\w+\\d{2,3}$");
        Matcher m = pattern.matcher("we23");
        System.out.println(m.matches());
        //===================================
        System.out.println(Pattern.matches("^\\d+\\s", "2 "));
        System.out.println(Pattern.matches("\\w+\\d{3,4}", "we23"));
        String[] strs = {"cat","is cat","other word,cat","acat"};
        for (String str : strs) {
            System.out.print(Pattern.compile("\\bcat").matcher(str).find());
            System.out.println("\tB\t"+Pattern.compile("\\Bcat").matcher(str).find());
        }





    }
}
